package me.suntao.javaio.server.bio;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.Socket;

/**
 * Created by suntao on 2017/6/2.
 */
public class EchoServerHandler implements Runnable {
  private Socket clientSocket;

  public EchoServerHandler(Socket clientSocket) {
    this.clientSocket = clientSocket;
  }

  public void run() {
    DataInputStream inputStream = null;
    try {
      inputStream = new DataInputStream(clientSocket.getInputStream());
      System.out.println("serverclient:"+Thread.currentThread().getName()+", clientmsg:" + inputStream.readUTF()+", donetime:"+System.currentTimeMillis());
      Thread.sleep(10);
    } catch (IOException e) {
      e.printStackTrace();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }

  }
}
